package vista;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JSeparator;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class frmCategoria extends javax.swing.JFrame {
	private JLabel lbldatoscategoria;
	private JLabel lblcodigocategoria;
	private JTextField txtcodigocategoria;
	private JLabel lblnombrecategoria;
	private JTextField txtnombrecategoria;
	private JSeparator sp;
	private JButton btnsalir;
	private JButton btncancelar;
	private JButton btnguardar;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				frmCategoria inst = new frmCategoria();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public frmCategoria() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			this.setFont(new java.awt.Font("Arial",0,10));
			this.setTitle("Registrar Categoria");
			{
				lbldatoscategoria = new JLabel();
				getContentPane().add(lbldatoscategoria);
				lbldatoscategoria.setText("Datos de la Categoria");
				lbldatoscategoria.setBounds(12, 23, 131, 37);
				lbldatoscategoria.setFont(new java.awt.Font("Segoe UI",1,12));
			}
			{
				lblcodigocategoria = new JLabel();
				getContentPane().add(lblcodigocategoria);
				lblcodigocategoria.setText("Codigo Categoria :");
				lblcodigocategoria.setBounds(17, 93, 166, 16);
			}
			{
				txtcodigocategoria = new JTextField();
				getContentPane().add(txtcodigocategoria);
				txtcodigocategoria.setBounds(138, 86, 80, 23);
			}
			{
				lblnombrecategoria = new JLabel();
				getContentPane().add(lblnombrecategoria);
				lblnombrecategoria.setText("Nombre Categoria :");
				lblnombrecategoria.setBounds(17, 134, 127, 16);
			}
			{
				txtnombrecategoria = new JTextField();
				getContentPane().add(txtnombrecategoria);
				txtnombrecategoria.setBounds(140, 131, 105, 23);
			}
			{
				btnguardar = new JButton();
				getContentPane().add(btnguardar);
				btnguardar.setText("Guardar");
				btnguardar.setBounds(53, 208, 85, 23);
			}
			{
				btncancelar = new JButton();
				getContentPane().add(btncancelar);
				btncancelar.setText("Cancelar");
				btncancelar.setBounds(149, 208, 96, 23);
			}
			{
				btnsalir = new JButton();
				getContentPane().add(btnsalir);
				btnsalir.setText("Salir");
				btnsalir.setBounds(260, 208, 71, 23);
			}
			{
				sp = new JSeparator();
				getContentPane().add(sp);
				sp.setBounds(0, 178, 384, 24);
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

	public void addListener(ActionListener actionListener) {
		btnguardar.addActionListener(actionListener);
		btncancelar.addActionListener(actionListener);
		btnsalir.addActionListener(actionListener);
}
	public void mostrarMensaje(String mensaje) {
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	public String getcodigocategoria() {
		return txtcodigocategoria.getText();
	}

	public String getnombrecategoria() {
		return txtnombrecategoria.getText();
	}
	
	public void borrarDatos()
	{
		txtcodigocategoria.setText("");
		txtnombrecategoria.setText("");
				
	}
	
}

